<html>
<head><meta charset="utf-8"><title>run rustdoc unit tests · rustdoc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/index.html">rustdoc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html">run rustdoc unit tests</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246913103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/246913103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#246913103">(Jul 22 2021 at 22:27)</a>:</h4>
<p>Does anyone know of a way to run rustdoc unit tests (i.e., the <code>#[test]</code>s in <code>src/librustdoc</code>) with <code>download-rustc</code>? <code>x.py test rustdoc</code> and <code>x.py test src/librustdoc</code> both start building the compiler.</p>



<a name="246915488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/246915488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#246915488">(Jul 22 2021 at 23:00)</a>:</h4>
<p><span class="user-mention" data-user-id="307537">@Noah Lev</span> does <code>--stage 2</code> help?</p>



<a name="246915498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/246915498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#246915498">(Jul 22 2021 at 23:01)</a>:</h4>
<p>if not, it's probably just not implemented in bootstrap</p>



<a name="246915503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/246915503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#246915503">(Jul 22 2021 at 23:01)</a>:</h4>
<p>but it should be an easy fix</p>



<a name="246924850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/246924850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#246924850">(Jul 23 2021 at 01:42)</a>:</h4>
<p>IIRC, <code>--stage 2</code> didn't work either.</p>



<a name="246924868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/246924868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#246924868">(Jul 23 2021 at 01:43)</a>:</h4>
<p>Where in bootstrap would it need to be implemented?</p>



<a name="246953463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/246953463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#246953463">(Jul 23 2021 at 08:42)</a>:</h4>
<p>For me it works as expected?</p>



<a name="247097025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247097025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247097025">(Jul 24 2021 at 22:37)</a>:</h4>
<p><span class="user-mention silent" data-user-id="210316">GuillaumeGomez</span> <a href="#narrow/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests/near/246953463">said</a>:</p>
<blockquote>
<p>For me it works as expected?</p>
</blockquote>
<p>Does it build the compiler when you run the tests though?</p>



<a name="247097481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247097481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247097481">(Jul 24 2021 at 22:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="307537">Noah Lev</span> <a href="#narrow/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests/near/246924868">said</a>:</p>
<blockquote>
<p>Where in bootstrap would it need to be implemented?</p>
</blockquote>
<p><span class="user-mention" data-user-id="307537">@Noah Lev</span> <a href="https://github.com/rust-lang/rust/blob/d9aa28767287670df6cf823b94629122e04442c0/src/bootstrap/test.rs#L2075">https://github.com/rust-lang/rust/blob/d9aa28767287670df6cf823b94629122e04442c0/src/bootstrap/test.rs#L2075</a></p>



<a name="247097652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247097652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247097652">(Jul 24 2021 at 22:58)</a>:</h4>
<p>probably due to the off-by-one numbering for rustdoc - the first thing I'd try is changing <code>compiler_for()</code> to <code>compiler()</code></p>



<a name="247097946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247097946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247097946">(Jul 24 2021 at 23:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="307537">Noah Lev</span> <a href="#narrow/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests/near/247097025">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="210316">GuillaumeGomez</span> <a href="#narrow/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests/near/246953463">said</a>:</p>
<blockquote>
<p>For me it works as expected?</p>
</blockquote>
<p>Does it build the compiler when you run the tests though?</p>
</blockquote>
<p>Unfortunately yes.</p>



<a name="247099610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247099610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247099610">(Jul 25 2021 at 00:02)</a>:</h4>
<p>Ah, yeah, that's what I mean by "not working" :)</p>



<a name="247099680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247099680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247099680">(Jul 25 2021 at 00:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests/near/247097652">said</a>:</p>
<blockquote>
<p>probably due to the off-by-one numbering for rustdoc - the first thing I'd try is changing <code>compiler_for()</code> to <code>compiler()</code></p>
</blockquote>
<p>tried this locally and ran into LLVM linking issues but not sure if they're related or not</p>



<a name="247099744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247099744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247099744">(Jul 25 2021 at 00:06)</a>:</h4>
<p>Also the problem with using <code>compiler</code> is that it rebuilds rustdoc even if it was built for running compiletests</p>



<a name="247099747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247099747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247099747">(Jul 25 2021 at 00:07)</a>:</h4>
<p>are you sure that's true even when download-rustc is set?</p>



<a name="247099752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247099752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247099752">(Jul 25 2021 at 00:07)</a>:</h4>
<p>it's fine to add an <code>if builder.download_rustc</code> there IMO</p>



<a name="247099754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247099754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247099754">(Jul 25 2021 at 00:07)</a>:</h4>
<p>Yes, because it's rebuilding rustdoc right now, and had I already built it for compiletest</p>



<a name="247099758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247099758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247099758">(Jul 25 2021 at 00:07)</a>:</h4>
<p>hmm, ok, I think I'm misunderstanding that code then. I'm not sure what the proper fix would be.</p>



<a name="247099760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247099760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247099760">(Jul 25 2021 at 00:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests/near/247099752">said</a>:</p>
<blockquote>
<p>it's fine to add an <code>if builder.download_rustc</code> there IMO</p>
</blockquote>
<p>Yeah, rebuilding just rustdoc would certainly be better than rebuilding all of rustc :)</p>



<a name="247108470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247108470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247108470">(Jul 25 2021 at 04:42)</a>:</h4>
<p>I can confirm that with the change from <code>compiler_for</code> to <code>compiler</code>, <code>x test src/librustdoc/</code> <em>does not</em> build the compiler, but <em>does</em> rebuild rustdoc.</p>



<a name="247108473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247108473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247108473">(Jul 25 2021 at 04:42)</a>:</h4>
<p>Although it seems like it's building rustdoc twice at once?</p>
<div class="codehilite"><pre><span></span><code>    Building [=======================&gt; ] 123/126: rustdoc, rustdoc
</code></pre></div>



<a name="247108482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247108482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247108482">(Jul 25 2021 at 04:43)</a>:</h4>
<p>Maybe it was rustdoc without <code>cfg(test)</code> + <code>rustdoc</code> with <code>cfg(test)</code>.</p>



<a name="247121889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247121889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247121889">(Jul 25 2021 at 11:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="307537">Noah Lev</span> <a href="#narrow/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests/near/247108482">said</a>:</p>
<blockquote>
<p>Maybe it was rustdoc without <code>cfg(test)</code> + <code>rustdoc</code> with <code>cfg(test)</code>.</p>
</blockquote>
<p>that seems likely</p>



<a name="247121899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/266220-rustdoc/topic/run%20rustdoc%20unit%20tests/near/247121899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests.html#247121899">(Jul 25 2021 at 11:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="307537">Noah Lev</span> <a href="#narrow/stream/266220-rustdoc/topic/run.20rustdoc.20unit.20tests/near/247108470">said</a>:</p>
<blockquote>
<p>I can confirm that with the change from <code>compiler_for</code> to <code>compiler</code>, <code>x test src/librustdoc/</code> <em>does not</em> build the compiler, but <em>does</em> rebuild rustdoc.</p>
</blockquote>
<p>I would take a PR for this if it were conditional on <code>download_rustc</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>